package com.company.huisuo.biz.dialog

import android.app.Activity
import android.view.LayoutInflater
import androidx.recyclerview.widget.GridLayoutManager
import com.company.huisuo.base.BaseBlurDialog
import com.company.huisuo.biz.adapter.ArtistTestDialogAdapter
import com.company.huisuo.databinding.DialogArtistTestBinding

/**
 * 艺人试台Dialog
 */
class ArtistTestDialog(val activity: Activity) : BaseBlurDialog<DialogArtistTestBinding>(activity) {

    private val mAdapter by lazy {
        ArtistTestDialogAdapter()
    }

    override fun getViewBinding(): DialogArtistTestBinding {
        return DialogArtistTestBinding.inflate(LayoutInflater.from(context))
    }

    override fun initView() {
        mBinding.rcvList.apply {
            layoutManager = GridLayoutManager(activity, 4)
            adapter = mAdapter
        }
        mAdapter.submitList(mockData())
        mBinding.tvOk.setOnClickListener {
            dismiss()
        }
    }

    private fun mockData(): ArrayList<Any> {
        val list = arrayListOf<Any>()
        for (i in 0..20) {
            list.add(i)
        }
        return list
    }
}